// 求和

#include <iostream>
using namespace std;

int GetNumber();

int Add1ToN(int n);

int main() {
    int n = GetNumber();

    cout << "main    &n = " << &n << "\n";
    int sum = Add1ToN(n);
    cout << "求和1 + 2 + ... + " << n << " 结果是 " << sum << "\n";
}

int GetNumber() {
    int number;
    cout << "请输入一个整数: ";
    cin >> number;
    return number;
}

int Add1ToN(int n) {
    cout << "Add1ToN &n = " << &n << "\n";
    int sum = 0;
    for (int i = 1; i <= n; i++) {
        sum += i;
    }
    return sum;
}